﻿using System.Collections.Generic;
using CH.FourBoards.LagerWalti.Persistence.Entities;
using CH.FourBoards.LagerWalti.Persistence.Setup.Creation;

namespace CH.FourBoards.LagerWalti.Persistence.Setup.FixedData
{
    internal class MasterDataGenerator : IDataGenerator
    {
        public void Create(DataContext context)
        {
            foreach (var type in CreateTransactionTypes()) {
                context.TransactionTypes.Add(type);
            }

        }

        private IEnumerable<TransactionType> CreateTransactionTypes()
        {
            var purchase = new TransactionType { Id = (int) NamedTransactionTypes.Purchase, Name = "Purchase" };
            var sale = new TransactionType { Name = "Sale" };
            var stocktaking = new TransactionType { Name = "Stocktaking" };
            return new[] { purchase, sale, stocktaking };
        }
    }
}
